/*
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/

#include "theme.h"

#include <glib.h>
#include <glib/gprintf.h>
#include <gtk/gtk.h>
#include <clutter/clutter.h>

static gchar colors[SEASTAR_THEME_COLOR_NUM][12];

void seastar_theme_set_colors (GtkWidget *win)
{
    GtkStyle *style;

    style = gtk_rc_get_style(win);

    g_snprintf (colors[SEASTAR_THEME_FG], 10, "#%02x%02x%02xff",
                style->fg[GTK_STATE_NORMAL].red >> 8,
                style->fg[GTK_STATE_NORMAL].green >> 8,
                style->fg[GTK_STATE_NORMAL].blue >> 8);

    g_snprintf (colors[SEASTAR_THEME_BG], 10, "#%02x%02x%02xff",
                style->bg[GTK_STATE_NORMAL].red >> 8,
                style->bg[GTK_STATE_NORMAL].green >> 8,
                style->bg[GTK_STATE_NORMAL].blue >> 8);

    g_snprintf (colors[SEASTAR_THEME_TEXT], 10, "#%02x%02x%02xff",
                style->text[GTK_STATE_NORMAL].red >> 8,
                style->text[GTK_STATE_NORMAL].green >> 8,
                style->text[GTK_STATE_NORMAL].blue >> 8);

    g_snprintf (colors[SEASTAR_THEME_BASE], 10, "#%02x%02x%02xff",
                style->base[GTK_STATE_NORMAL].red >> 8,
                style->base[GTK_STATE_NORMAL].green >> 8,
                style->base[GTK_STATE_NORMAL].blue >> 8);
}

ClutterColor seastar_theme_get_color (ThemeInfo i)
{
    ClutterColor ccol;

    clutter_color_parse(colors[i], &ccol);

    return ccol;
}
